#include "HitPointHandler.h"

HitPointHandler::HitPointHandler(HitPointable* receiver): hitPointable(receiver)
{
}

HitPointHandler::HitPointHandler(const HitPointHandler& rhs): hitPointable(rhs.hitPointable)
{
}


HitPointHandler::~HitPointHandler()
{
}

GameEventHandler* HitPointHandler::Clone() const
{
	return new HitPointHandler(*this);
}

bool HitPointHandler::CanHandle(const GameEvent* gameEvent) const
{
	return hitPointable && gameEvent->Equals(&hitPointEvent);
}

void HitPointHandler::HandleEvent(GameEvent* gameEvent)
{
	if (hitPointable && gameEvent->Equals(&hitPointEvent))
	{
		hitPointEvent.Copy(gameEvent);

		unsigned int x, y;
		hitPointable->HitPoint(&x, &y);
		hitPointEvent.SetHitPoint(x, y);

		gameEvent->Copy(&hitPointEvent);
	}
}
